class User{
    private String name;
    private String password;
    private double balance;

    public User(String name, String password, double balance) {
        this.name = name;
        this.password = password;
        this.balance = balance;
    }

    public void Deposit(double money) {
        this.balance += money;
        show();
    }

    public void Withdrawal(double money){
        if(this.balance >= money){
            this.balance -= money;
            show();
        }else {
            System.out.println("取款金额大于剩余存款");
            show();
            System.exit(0);
        }
    }

    public void show(){
        System.out.println("剩余存款" + this.balance);
    }

    public synchronized void operation(int num,double money){
        System.out.print(Thread.currentThread().getName() + "执行操作：");
        if(num == 1){
            Deposit(money);
        }else if(num == 2){
            Withdrawal(money);
        }
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public double getBalance() {
        return balance;
    }

    public void setBalance(double balance) {
        this.balance = balance;
    }
}